package com.sh.enums;

public enum OssTypeEnum {
    MINIO(1, "MINIO"),
    OSS(2, "OSS"),
    OBS(3, "OBS"),
    BOS(4, "BOS"),
    COS(5, "COS");


    private Integer code;
    private String name;

    OssTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static Integer getCode(String name) {
        for (OssTypeEnum storeType : OssTypeEnum.values()) {
            if (storeType.name.equals(name)) {
                return storeType.getCode();
            }
        }
        return null;
    }

    public static String getName(Integer code) {
        for (OssTypeEnum storeType : OssTypeEnum.values()) {
            if (storeType.code.equals(code)) {
                return storeType.getName();
            }
        }
        return null;
    }

}
